<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php $this->load->view('include/html_head')?>
</head>
<body>
<div id="wrapper">
	<?php $this->load->view('include/header')?>
	<?php $this->load->view('include/menu')?>
	<div id="page">
		<div id="content">
		<?php $this->load->view('include/sub_navi')?>
			<div class="post">
			<form action='<?php echo BACKEND_SOCIETY_UPDATE_INFO_POST_PATH ?>' method=post id='update_info_form'>
				<p class="meta">社团信息修改</p>
				<div class="entry">
				<ul>
					<fieldset style='padding-left: 10px;'>
					<legend>社团基本信息</legend>
					<li>
						
						<label>社团全称:</label>
						<input type='text' id='s_name' class="validate[required,minSize[2],maxSize[15],custom[onlyLetterNumberWithChinese],ajax[ajaxUpdateSocietyName]] text-input" name='s_name' value='<?php echo set_value('s_name', $society['s_name'])?>' />
						<?php echo form_error('s_name', '<div class="error">', '</div>'); ?>
					</li>
					
					<li>
						
						<label>社团简称:</label>
						<input type='text' id='abbr' class="validate[required,minSize[2],maxSize[15],custom[onlyLetterNumberWithChinese],ajax[ajaxUpdateSocietyAbbr]] text-input" name='abbr' value='<?php echo set_value('abbr', $society['abbr'])?>' />
						<?php echo form_error('abbr', '<div class="error">', '</div>'); ?>
					</li>
					
						<script>
						//给下拉菜单绑值
						$(function() {
							var society_array = getAllSocietyCategory();
							for (var i= 0; i < society_array.length; i++) {
								$('#s_category').append("<option value=" + (i + 1) + ">" + society_array[i] + "</option>");
							}
							$('#s_category option').each(function() {
								if($(this).val() == <?php echo $society['s_category'] + "" ?>) {
									$(this).attr("selected", "selected");
								}
							});
						});
						</script>
					<li>
						
						<label>社团类别:</label>
						<select name="s_category" id="s_category" class="validate[required]">
							<option value="" selected="selected">请选择</option>
						</select>
						<?php echo form_error('s_category', '<div class="error">', '</div>'); ?>
					</li>
					
						<script>
						//给下拉菜单绑值
						$(function() {
							$('#since option').each(function() {
								if($(this).val() == <?php echo $society['since'] + "" ?>) {
									$(this).attr("selected", "selected");
								}
							});
						});
						</script>
					<li>
						
						<label>创办年份:</label>
						<select name='since' id='since' class="validate[required]">
							<option value="" selected="selected">请选择</option>
							<?php for ($i = date("Y", time()); $i >= date("Y", time()) - 15; $i--):?>
							<option value='<?php echo $i;?>' ><?php echo $i;?>年</option>
							<?php endfor;?>
						</select>
						<?php echo form_error('since', '<div class="error">', '</div>'); ?>
					</li>
					
					<li>
						
						<label>社团人数:</label>
						<input type='text' id='member_num' name='member_num' class="validate[required,minSize[1],maxSize[3],custom[integer]] text-input" value='<?php echo set_value('member_num', $society['member_num'])?>' />&nbsp;人
						<?php echo form_error('member_num', '<div class="error">', '</div>'); ?>
					</li>
					
					<li>
						
						<label>社团主页:</label>
						<input type='text' id='web_site' name='web_site' class="validate[required,custom[url]] text-input" value='<?php echo set_value('web_site', $society['web_site'])?>' />
						<?php echo form_error('web_site', '<div class="error">', '</div>'); ?>
					</li>
					
					<li>
						
						<label>社团简介:</label><br />
						<textarea id='about' name="about" class="validate[required,minSize[50],maxSize[1000]] text-input" rows='12' cols='57'><?php echo set_value('about', $society['about']) ?></textarea>
						<script type="text/javascript">
				        	var editor = CKEDITOR.replace('about',
				        		{
				    				skin : 'office2003',
				    				toolbar : 'Basic',
				    			});
				        	CKFinder.setupCKEditor(editor, '/ckfinder/');
				    	</script>
						<?php echo form_error('about', '<div class="error">', '</div>'); ?>
					</li>
					</fieldset>
					
					<fieldset>
					<legend>社团负责人信息</legend>
					<li>
						
						<label>姓名:</label>
						<input type='text' id='contact' name='contact' class="validate[required,minSize[2],maxSize[4],custom[onlyChinese]] text-input" value='<?php echo set_value('contact', $society['contact'])?>' />
						<?php echo form_error('contact', '<div class="error">', '</div>'); ?>
					</li>
					
						<script>
						//给下拉菜单绑值
						$(function() {
							var col_array = getAllCol();
							for (var i= 0; i < col_array.length; i++) {
								$('#contact_col').append("<option value=" + col_array[i][0] + ">" + col_array[i][1] + "</option>");
							}
							$('#contact_col option').each(function() {
								if($(this).val() == <?php echo $society['contact_col'] + "" ?>) {
									$(this).attr("selected", "selected");
								}
							});
						});
						</script>
					<li>
						
						<label>学院:</label>
						<select name='contact_col' id='contact_col' class="validate[required]" onchange="f_change_col_pro(this,document.getElementById('contact_pro'));">
							<option value="" selected="selected">请选择</option>
						</select>
						<?php echo form_error('contact_col', '<div class="error">', '</div>'); ?>
					</li>
					
						<script>
						//给多级联动的下级下拉菜单绑值
						$(function() {
							var val = $('#contact_col').val();
							var pro_array = getProByColId(val);
							for (var i= 0; i < pro_array.length; i++) {
								$('#contact_pro').append("<option value=" + pro_array[i][0] + ">" + pro_array[i][1] + "</option>");
							}
							$('#contact_pro option').each(function() {
								if($(this).val() == <?php echo $society['contact_pro'] + "" ?>) {
									$(this).attr("selected", "selected");
								}
							});
						});
						</script>
					<li>
						
						<label>专业:</label>
						<select name='contact_pro' id='contact_pro' class="validate[required]" >
							<option value="" selected="selected">请选择</option>
						</select>
						<?php echo form_error('contact_pro', '<div class="error">', '</div>'); ?>
					</li>
					
					<li>
						
						<label>手机:</label>
						<input type='text' id='contact_phone' name='contact_phone' class="validate[required,custom[mobilenumber]] text-input" value='<?php echo set_value('contact_phone', $society['contact_phone'])?>' />
						<?php echo form_error('contact_phone', '<div class="error">', '</div>'); ?>
					</li>
					
					<li>
						
						<label>QQ：</label>
						<input type='text' id='contact_qq' name='contact_qq' class="validate[required,custom[qq]] text-input" value='<?php echo set_value('contact_qq', $society['contact_qq'])?>' />
						<?php echo form_error('contact_qq', '<div class="error">', '</div>'); ?>
					</li>
					</fieldset>
					
					<fieldset>
					<legend>社团指导老师信息</legend>
					<li>
						
						<label>姓名:</label>
						<input type='text' id='t_name' name='t_name' class="validate[required,minSize[2],maxSize[4],custom[onlyChinese]] text-input" value='<?php echo set_value('t_name', $teacher['t_name'])?>' />
						<?php echo form_error('contact', '<div class="error">', '</div>'); ?>
					</li>
					
					<li>
						
						<label>手机:</label>
						<input type='text' id='t_phone' name='t_phone' class="validate[required,custom[mobilenumber]] text-input" value='<?php echo set_value('t_phone', $teacher['t_phone'])?>' />
						<?php echo form_error('t_phone', '<div class="error">', '</div>'); ?>
					</li>
					</fieldset>
					
					<li>
						<input type="hidden" name='id' value='<?php echo $society['id']?>' />
						<button type='submit'>保存</button>&nbsp;
						<a class='anchor_button' onclick="history.back(-1);" >返回</a>
					</li>
				</ul>
				</div>
			</form>
			</div>
			<?php if (!isset($msg)):?>
		 	<div style='overflow: hidden;' id='society_msg_dialog' title='重要提示'>
		 	<span class='tip'>您的社团还在审核中，无法修改信息</span>
			</div>
			<script>
			$("#society_msg_dialog").dialog({
				resizable: false,
				draggable: false,
				modal: true,
				buttons: {
					"返回": function() {
						history.back(-1);
					}
				}
			});
			$("a.ui-dialog-titlebar-close").hide();
			</script>
		 	<?php endif;?>
			
			<div style="clear: both;">&nbsp;</div>
		</div>
		<!-- end #content -->
		<?php $this->load->view('include/side_bar')?>
		<div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end #page -->
</div>
<?php $this->load->view('include/footer_content')?>
<?php $this->load->view('include/footer')?>
</body>
</html>
